<?php
// 控制台配置
return [
    //应用ID
    'id' => 'Template',
    //项目路径
    'basePath' => dirname(__DIR__),
    //别名
    'aliases' => [
        '@app' => dirname(__DIR__),
    ],
    //启动引导
    'bootstrap' => ['log','queue'],
    //全局参数
    'params' => [],
    //框架模块
    'modules' => [
        'bg' => ['class' => \app\modules\bg\Module::class],
    ],
    //组件配置
    'components' => [
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => YII_ENV == 'dev' ? 'yii\log\FileTarget' : 'yii\log\DbTarget',
                    'levels' => YII_ENV == 'dev' ? ['error', 'warning'] : ['error'],
//                    'levels' => ['error', 'warning', 'info', 'trace'], // 启用 trace 级别以记录调试信息
//                    'categories' => ['yii\queue\*'], // 记录队列相关的日志
                ],
            ],
        ],
        'redis' =>  require __DIR__ . '/redis.php',
        'queue' => [
            'class' => \yii\queue\redis\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,//错误日志 默认为 console/runtime/logs/app.log
            'redis' => 'redis', // 连接组件或它的配置
            'channel' => 'queue', // Queue channel key
        ],
        'db' =>  require __DIR__ . '/db.php',
        'caching' => [
            'class' => 'sookie\caching\CacheHandler',
            'autoUpdateKey' => 'youhappyisgood',
            'table' => 'sys_cache_mapping',
            'dbLink' => 'db'
        ],
        'cache' => [
            'class' => yii\redis\Cache::className()
        ],
        'errorHandler' => [
            'class' => \app\common\service\CustomErrorHandler::class
        ]
    ]
];
